#include<bits/stdc++.h>
#define int long long
using namespace std;
namespace IO
{
	char buff[1<<21],*p1=buff,*p2=buff;
	char getch(){return p1==p2&&(p2=((p1=buff)+fread(buff,1,1<<21,stdin)),p1==p2)?EOF:*p1++;}
	template<typename T>void read(T &x){char ch=getch();int fl=1;x=0;while(ch>'9'||ch<'0'){if(ch=='-')fl=-1;ch=getch();}while(ch<='9'&&ch>='0'){x=x*10+ch-48;ch=getch();}x*=fl;}
	template<typename T>void read_s(T &x){char ch=getch();while(ch<'a'||ch>'z')ch=getch();while(ch>='a'&&ch<='z'){x+=ch;ch=getch();}}
	template<typename T,typename ...Args>void read(T &x,Args& ...args){read(x);read(args...);}
	char obuf[1<<21],*p3=obuf;
	void putch(char ch) {if(p3-obuf<(1<<21))*p3++=ch;else fwrite(obuf,p3-obuf,1,stdout),p3=obuf,*p3++=ch;}
	char ch[100];
	template<typename T>void write(T x) {if(!x)return putch('0');if(x<0)putch('-'),x*=-1;int top=0;while(x)ch[++top]=x%10+48,x/=10;while(top)putch(ch[top]),top--;}
	template<typename T,typename ...Args>void write(T x,Args ...args) {write(x);write(args...);}
	void put(string s){for(int i=0;i<s.size();i++)putch(s[i]);}
	void flush(){fwrite(obuf,p3-obuf,1,stdout);}
}
using namespace IO;
int n;
struct node
{
	int a,h;
	bool operator<(const node &x)const{return a==x.a?h>x.h:a<x.a;}
}a[200005];
inline int calc(int x,int y){return ((a[y].h+a[x].a-1)/a[x].a-1)*a[y].a;}
namespace sub1
{
	node dis[200005];
	int vis[200005],from[200005];
	priority_queue<pair<node,int> >q;
	void dij()
	{
		for(int i=1;i<=n;i++) dis[i]=(node){1000000000,0};dis[0]=(node){0,0};
		q.push({(node){0,0},0});
		while(q.size())
		{
			int u=q.top().second;q.pop();
			if(vis[u]) continue;
			vis[u]=1;
			for(int v=u+1;v<=n;v++)
				if((node){dis[u].a+calc(u,v),dis[u].h+1}<dis[v])
				{
					dis[v].a=dis[u].a+calc(u,v);
					dis[v].h=dis[u].h+1;
					from[v]=u;
					q.push({(node){-dis[v].a,dis[v].h},v});
				}
		}
	}
	void Main()
	{
		sort(a+1,a+n+1);
		dij();
		memset(vis,0,sizeof vis);
		int ans=dis[n].a,p=n;
		while(p) vis[p]=1,p=from[p];
		for(int i=1;i<=n;i++) if(!vis[i]) ans+=calc(n,i);
		write(ans);
	}
}
signed main()
{
	freopen("xinyue.in","r",stdin);
	freopen("xinyue.out","w",stdout);
	read(n,a[0].a);
	for(int i=1;i<=n;i++) read(a[i].a,a[i].h);
	sub1::Main();
	flush();
	return 0;
}
